
<!DOCTYPE html>
<html lang="en"
<head>
    <meta charset="utf8"
    <title></title>
    <link rel="stylesheet" href="/back/css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="/back/css/bootstrap.min.css">
    <link href="http://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
</head>
<style>
    .th{
        width:150px;
        font-family: 宋体;
        text-align: center;
    }

    .th1{
        width:200px;
        font-family: 宋体;
        text-align: center;
    }
    .th2{
        width:300px;
        font-family: 宋体;
        text-align: center;
    }
    .th3{
        width:60px;
        font-family: 宋体;
        text-align: center;
    }
    .img-thumbnail{
        width:100px;
        height:100px;
    }

    .input-group{
        float:right;

    }
    .btn-primary{
        float:left;
        margin-left: 350px;
        margin-right: 115px;
    }
    .input-group-btn{
        display: block;
        margin-right: 0px;
        width:400px;
    }

    .table-bordered td,.table-bordered th{
        border:2px solid #5bc0de!important
    }


</style>
<body>

<div class="container">
    <h3 class="title1">漫画信息管理</h3>
    <div class="page-header">
    </div>
        <p>

        <div class="row">

            <a href="/back/cartoon/cartoonAdd.php" class="btn  btn-primary">
                <span class="glyphicon glyphicon-plus">添加</span>
            </a>

            <form action="cartoonSearch.php" method="post">
                <div class="col-lg-6">
                    <div class="input-group">
                        <input type="text" class="form-control" id="cname" name="cname"placeholder="输入漫画名">
                        <span class="input-group-btn">
                        <button class="btn btn-info" type="submit" >搜索</button>
                        </span>
                    </div>
                </div>
            </form>


        </div>
        </p>


        <table  class="table table-bordered">
            <thead>
            <tr>

                <th class="th3">作品ID</th>
                <th class="th">漫画名称</th>
                <th class="th">漫画类型</th>
                <th class="th1">漫画封面</th>
                <th class="th1">漫画作者</th>
                <th class="th2">作品简介</th>
                <th class="th3">漫画状态</th>
                <th class="th3">操作</th>
            </tr>
            </thead>
            <tbody>
            <?php
            $pagesize=3;
            $pageindex=0;
            if(!empty($_GET["pageindex"]))
            {
                $pageindex=$_GET["pageindex"];
            }
            $offset=$pagesize * $pageindex;
           include dirname(__FILE__) .'../../common/conn.php';
            $countSql="select count(*) from production";
            $countRes=mysqli_query($con,$countSql);
            $row=mysqli_fetch_array($countRes);
            $count=$row[0];

            $sql="select production.id as id,production.name as title,type.name as ptype,production.coverPic as picture,production.author as author,production.introduction as introduction,production.state as state from production inner join type on production.typeId=type.id order by id limit $offset,$pagesize ";
            $res=mysqli_query($con,$sql);
            if($res) {
                while ($row = mysqli_fetch_array($res)) {
                    ?>
                    <tr>
                        <td class="th3"><?php  echo $row["id"]?></td>
                        <td class="th"><?php  echo $row["title"]?></td>
                        <td class="th"><?php  echo $row["ptype"]?></td>
                        <td class="th1"><img align="middle" class="img-thumbnail" src="<?php  echo $row["picture"]?>"></td>
                        <td class="th"><?php  echo $row["author"]?></td>
                        <td class><?php  echo $row["introduction"]?></td>
                        <td class="th3"><?php  echo $row["state"]?></td>
                        <td>

                            <a href="/back/cartoon/cartoonEdit.php?id=<?php echo $row["id"] ?>">
                                <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
                            </a>
                            <a href="/back/cartoon/cartoonDelete.php?id=<?php echo $row["id"] ?>" onClick="return confirm('确定删除?');">
                                <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
                            </a>

                        </td>
                    </tr>
                    <?php
                }
            }
            ?>
            </tbody>
        </table>
        <nav class="page">
            <ul class="pager">
                <li><a href="/back/cartoon/list.php?pageindex=<?php echo $pageindex-1>0?$pageindex-1 :0 ; ?>">上一页</a></li>
                <li>总共：<?php echo $count?>条记录 共<?php echo ceil($count/$pagesize)?>页</li>
                <li><a href="/back/cartoon/list.php?pageindex=<?php echo $pageindex+1>=ceil($count/$pagesize)?ceil($count/$pagesize)-1 : $pageindex+1 ?>">下一页</a></li>
            </ul>
        </nav>


</div>
</body>
</html>